package kr.snake75.aop;

import org.apache.log4j.Logger;
import org.aspectj.lang.ProceedingJoinPoint;

public class LogAdvice {
	private static Logger logger = Logger.getLogger(LogAdvice.class);
	
	public void printLog() {
		logger.info("1---------------------------------------------------------------------------------------");
		logger.info("2---------------------------------------------------------------------------------------");
		logger.info("3---------------------------------------------------------------------------------------");
		logger.info("4---------------------------------------------------------------------------------------");
	}
	
	public Object printTime(ProceedingJoinPoint pjp) throws Throwable {
		long start = System.currentTimeMillis();
		
		Object target = pjp.getTarget();
				
		Object result = pjp.proceed();
		
		long end = System.currentTimeMillis();
		
		logger.info("target : " + target + ", time: " + (end - start));
		
		return result;
	}
}
